package br.org.etec.dotcao.service.jpa;

import br.org.etec.dotcao.exception.InvalidCredentialException;
import br.org.etec.dotcao.model.OauthInfo;
import br.org.etec.dotcao.model.User;
import br.org.etec.dotcao.model.UserRepository;
import br.org.etec.dotcao.service.UserService;

public class UserServiceImpl extends ServiceImpl<User> implements UserService {

	public UserServiceImpl() {
		super(User.class);
	}

	@Override
	public User authenticate(String username, String password) throws InvalidCredentialException{
		UserRepository repo = (UserRepository) repository();
		return repo.authenticate(username, password);
	}

	@Override
	public User authenticate(OauthInfo oauth) throws InvalidCredentialException{
		UserRepository repo = (UserRepository) repository();
		return repo.authenticate(oauth);
	}

	@Override
	public User getByEmail(String email) {
		UserRepository repo = (UserRepository) repository();
		return repo.getByEmail(email);
	}

}
